    /*
     * 启动
     */
    mui.init();
    mui('.mui-scroll-wrapper').scroll({
        indicators: false,      //是否显示滚动条 默认为true
        deceleration: 0.003,    //阻尼系数,系数越小滑动越灵敏 默认0.0006
        bounce: false           //是否启用回弹 默认true
    });
    /*
     * 变量初始化
     */
    var that = getUrlParam('that');
    var code_mobile = '';
    /*
     * 主程序
     */ 
    $(document).ready(function() 
    {
        pagecss();
    });
    /**
     * pagecss
     * 样式加载
     * @cc 
     * @DateTime 2018-01-08T06:19:16+0800
     * @param    int        
     * @return   void
     */
    function pagecss(){
        that=='login' ? $(".password0").css({display:'none'}) : $(".password0").css({display:'block'});
        
    }
    $('.rdntn').on('tap',function(){
        var password0 = $("input[name='password0']").val();
        var password = $("input[name='password']").val();
        var password2 = $("input[name='password2']").val();
        var mobile = that=='login'?localStorage.replace_reset_mobile :localStorage.replace_mobile;
        var reg = new RegExp(/[A-Za-z].*[0-9]|[0-9].*[A-Za-z]/);
        if(password0 == ''&&!that) {
            mui.toast('请输入原始密码！',{ duration:2000, type:'div' });
            return false
        }else if(password == '') {
            mui.toast('请输入密码！',{ duration:2000, type:'div' });
            return false
        }else if(password2 == '') {
            mui.toast('请输入确认密码！',{ duration:2000, type:'div' });
            return false
        }else if(password2.length < 6||password.length < 6||(password0.length < 6&&!that)) {
            mui.toast('密码不小于6位字符！',{ duration:2000, type:'div' });
            return false
        }else if(password != password2) {
            $("input[name='password2']").val('');
            mui.toast('密码不一致！',{ duration:2000, type:'div' });
            return false
        }else if(!reg.test(password)) {
            mui.toast('密码必须为数字和字母结合！',{ duration:2000, type:'div' });
            return false;
        }
        $('body').append('<div class="ys-modal-loading"><div class="mui-spinner"></div></div>');
        $('body').on('tap','.ys-modal-loading',function(){
            $(this).remove();
        })
        
        if(that){
            $.ajax({
                type: "post",
                url: DOMAIN_NAME + "/index.php/api/user/resetForgetPassword",
                dataType:'jsonp',
                data: { mobile: mobile, password: password },
                success: function(data) {
                    if(data.error_code == 0) {
                        $(".ys-modal-loading").remove();
                            localStorage.removeItem('localStorage.replace_reset_mobile');
                            mui.toast('修改成功！',{ duration:2000, type:'div' });
                            setTimeout(function(){
                                exitlogin();
                            },1000);
                    }else{
                        $(".ys-modal-loading").remove();
                        mui.toast(data.error_msg,{ duration:2000, type:'div' });
                    }
                }
            });
        }else{
            var uid= localStorage.replace_uid;
            var token= localStorage.replace_token;
            $.ajax({
                type: "post",
                url: DOMAIN_NAME + "/index.php/api/user/passwordReset",
                dataType:'jsonp',
                data: {uid:uid,token:token, mobile: mobile, password: password ,password1:password0},
                success: function(data) {
                    if(data.error_code == 0) {
                        $(".ys-modal-loading").remove();
                            localStorage.removeItem('localStorage.replace_mobile');
                            mui.toast('修改成功！',{ duration:2000, type:'div' });
                            setTimeout(function(){
                                mui.back();
                                var list = plus.webview.currentWebview().opener();//触发父页面的自定义事件(refresh),从而进行刷新
                                mui.fire(list, 'exit');//返回true,继续页面关闭逻辑
                                return true;
                            },1000);
                    }else{
                        $(".ys-modal-loading").remove();
                        mui.toast(data.error_msg,{ duration:2000, type:'div' });
                    }
                }
            });
        }
    });

